/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Dalton
 */
@Entity
@Table(name = "tipoobra")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tipoobra.findAll", query = "SELECT t FROM Tipoobra t"),
    @NamedQuery(name = "Tipoobra.findByIdtipoobra", query = "SELECT t FROM Tipoobra t WHERE t.idtipoobra = :idtipoobra"),
    @NamedQuery(name = "Tipoobra.findByNombre", query = "SELECT t FROM Tipoobra t WHERE t.nombre = :nombre")})
public class Tipoobra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idtipoobra")
    private Integer idtipoobra;
    @Size(max = 2147483647)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoobra")
    private List<Detallefactura> detallefacturaList;

    public Tipoobra() {
    }

    public Tipoobra(Integer idtipoobra) {
        this.idtipoobra = idtipoobra;
    }

    public Integer getIdtipoobra() {
        return idtipoobra;
    }

    public void setIdtipoobra(Integer idtipoobra) {
        this.idtipoobra = idtipoobra;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public List<Detallefactura> getDetallefacturaList() {
        return detallefacturaList;
    }

    public void setDetallefacturaList(List<Detallefactura> detallefacturaList) {
        this.detallefacturaList = detallefacturaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtipoobra != null ? idtipoobra.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipoobra)) {
            return false;
        }
        Tipoobra other = (Tipoobra) object;
        if ((this.idtipoobra == null && other.idtipoobra != null) || (this.idtipoobra != null && !this.idtipoobra.equals(other.idtipoobra))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Tipoobra[ idtipoobra=" + idtipoobra + " ]";
    }
    
}
